package org.bugeden.netdisk.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by IntelliJ IDEA.
 * User: gzhang
 * Date: 2010-6-11
 * Time: 21:59:25
 * To change this template use File | Settings | File Templates.
 */
public class UIView {

    private static Properties properties = new Properties();
    public static final int CH = 1;
    public static final int EN = 2;

    static {
        setLangProperties(EN);
    }

    static public String UIName(String name) {
        return properties.getProperty(name, "undefined");
    }



    static public void setLangProperties(int lan) {
        InputStream is = null;
        switch (lan) {
            case CH:
                is = ClassLoader.getSystemClassLoader().getResourceAsStream("META-INF/lang-ch.properties");
            case EN:
                is = ClassLoader.getSystemClassLoader().getResourceAsStream("META-INF/lang-en.properties");
            default:
                is = ClassLoader.getSystemClassLoader().getResourceAsStream("META-INF/lang-en.properties");
        }
        try {
            properties.load(is);
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }


}
